package org.liquidByte.simpleChat.communication;

public class ChannelCall extends ChannelData {
	private static final long serialVersionUID = 8859829295415199999L;
	private static long currentIdentifier = 0;
	private Object operation;
	private Object[] params;
	
	public ChannelCall(Object operation, Object[] params) {
		super(ChannelCall.getNextIdentifier());
		this.operation = operation;
		this.params = params;
	}
	
	public Object getOperation() {
		return operation;
	}
	public Object[] getParams() {
		return params;
	}
	@Override
	public Type getType() {
		return Type.CALL;
	}
	public boolean isCallOf(ChannelResponse response) {
		return this.getIdentifier() == response.getIdentifier();
	}
	private static synchronized long getNextIdentifier() {
		return ChannelCall.currentIdentifier++;
	}	
}
